# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html


# useful for handling different item types with a single interface
from itemadapter import ItemAdapter


class GamePipeline:  # 默认定义的管道类，类名随便写，方法名是定死的
    def process_item(self, item, spider):  # 默认已确定的方法，是处理数据的专用方法 item就是管道传过来的数据
        print(item, spider.name)  # 打印数据, 爬虫的名字

        return item  # return到下一个管道


class MyPipeline:  # 自定义pipeline
    def process_item(self, item, spider):
        item['love'] = "我是周杰伦的粉丝！"

        return item
